<?php
ob_start();
session_start();
$_SESSION['page']="esa/img_select.php";

if(isset($_GET['logo'])){ 
    $_SESSION['logo']=$_GET['logo'];
}else{
    $logo=$_SESSION['logo'];
}    

$logo=$_SESSION['logo'];
//print_r($logo);

try{
    
    
    include_once('restconnection.php');
         
    if(isset($client)){
        
 
        //retrive base url 
        $url = $_SESSION['basic_url'];
        //add service url
        $service_url="/GetAvatarUser?";
        //params url
        $params = array('id'=>$_SESSION['id']);
        //params connection
        $ctx = stream_context_create(array('http' => array('timeout' => 1))); 
        //send GET request
       // print_r($url.$service_url."id=".$params['id']); break;
        $output = @file_get_contents($url.$service_url."id=".$params['id'],0,$ctx);
        //parse JSON output
        $data = json_decode($output);
        $webResult = $data->GetAvatarUserResult;

        
        $avatar_user=$webResult;
        
       

        $urlfb=$avatar_user[0];
        $urlgo=$avatar_user[1];
        $urltw=$avatar_user[2];
        
      
    }
}  catch (Exception $e){
       
      ?>
          <label style="color:red;font-size:15px;">Sorry Connection Error!</label><br/>
          <label><a><element onclick=" var link='esa/login_page.php'; ovv_mainother(link);" > Click to continue </a></label>
          
      <?php    
       
   }     

?>
<script>selected_img(); select_img();</script>
<div id="container">
     <?php if($urlfb!=""){ ?><div class="imgcontainer"><img id="imgfb" url_img="<?php echo$logo;?>" title="Facebook"   src="<?php echo$urlfb; ?>" width="40px"/></div><?php }else{} ?>
     <?php if($urlgo!=""){ ?><div class="imgcontainer"><img id="imggo" url_img="<?php echo$logo;?>" title="Google"   src="<?php echo$urlgo; ?>" width="40px"/></div><?php }else{} ?>
     <?php if($urltw!=""){ ?><div class="imgcontainer"><img id="imgtw" url_img="<?php echo$logo;?>" title="Twitter"   src="<?php echo$urltw; ?>" width="40px"/></div><?php }else{} ?>
</div>   
<div>
           <input type="button"  onclick="send_data_img();" title="Save" value="Save" name="send" id="send" />
           <input type="hidden" value="<?php echo$logo; ?>" name="hidden_img" id="hidden_img" />
           
           <div class="clear"></div>
</div>
  <div class="spacer"></div>
   <a><element onclick=" var link='esa/home.php'; ovv_mainother(link);" > Go back </a>
   